import dispatcher from './dispatcher'
import {getList} from './api'

class Actions {
  add(value) {
    const action = {
      actionType: 'add',
      payload: value
    }

    dispatcher.dispatch(action)
  }

  async getList() {
    const data = await getList()
    const action = {
      actionType: 'getList',
      payload: data
    }

    dispatcher.dispatch(action)
  }

  remove(id) {
    const action = {
      actionType: 'remove',
      payload: id
    }

    dispatcher.dispatch(action)
  }
}

export default Actions